#ifndef CONSOLE_H
#define CONSOLE_H

#include <QTextBrowser>
#include "Include/IConsole.h"

class Console : public QTextBrowser, public Plugins::IConsole
{
    Q_OBJECT
public:
    explicit Console(QWidget *parent = 0);

    virtual void addLine(const QString & line);
    virtual void addLine(const QString & line, const QString & cls);
    virtual void setRoot(const QString & path);
    virtual void clearConsole();
signals:
    void fileNavigate(const QString file, int offset);
private slots:
    void onAnchorClicked(const QUrl & url);
    void onTimer();
private:
    void appendLine(const QString & line);
    QString prepare(const QString & line);
    QString _rootPath;
    QStringList _buffer;
    QTimer *_timer;
};

#endif // CONSOLE_H
